﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infrastructure
{
    public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<UserContext>
    {
        public UserContext CreateDbContext(string[] args)
        {
            DbContextOptionsBuilder<UserContext> builder = new DbContextOptionsBuilder<UserContext>();
            string? mySqlConStr = "server=82.157.168.172;database=DDD_UserManager;uid=feng;pwd=123456Feng!;charset=utf8;";
            builder.UseMySql(mySqlConStr, ServerVersion.AutoDetect(mySqlConStr))
                   .EnableDetailedErrors().EnableSensitiveDataLogging();
            return new UserContext(builder.Options);
        }
    }
}
